using System;
using System.Data.Linq;

namespace RomanJendrusz.Amazon.ETL.Domain
{
    public class Seller
    {
        private readonly EntitySet<SellerFeedback> feedbacks;
        private DateTime updated;

        public Seller()
        {
            feedbacks = new EntitySet<SellerFeedback>(onAdded, onRemoved);
        }

        public string SellerId { get; set; }
        public string Name { get; set; }
        public string NickName { get; set; }
        public string LegalName { get; set; }
        public string GlancePage { get; set; }
        /// <summary>
        /// Gets or sets the row updated.
        /// </summary>
        /// <value>The row updated.</value>
        public DateTime Updated
        {
            get { return updated; }
        }

        public EntitySet<SellerFeedback> Feedbacks
        {
            get { return feedbacks; }
            set { feedbacks.Assign(value); }
        }

        private void onAdded(SellerFeedback obj)
        {
            obj.Seller = this;
        }

        private void onRemoved(SellerFeedback obj)
        {
            if (obj.Seller == this)
            {
                obj.Seller = null;
            }
        }
    }
}